class Solution {

public:
    vector<string> removeAnagrams(vector<string>& words) {
        
        int n=words.size();
        vector<string> vecRet;
        for(int i=0;i<words.size();++i){
            string t=words[i];
            sort(t.begin(),t.end());
            if(vecRet.empty()){
                vecRet.push_back(words[i]);
            }
            else{
                string sBack=vecRet.back();
                sort(sBack.begin(),sBack.end());
                if(sBack==t){
                    continue;
                }
                else{
                    vecRet.push_back(words[i]);
                }
            }
        }

        return vecRet;
    }
};
